<?php
class Language
{




    /**
     * Enthaelt alle Ausdruecke der jeweiligen Sprache
     *
     * @var unknown_type
     */
    private $language;
    private $info;




    /**
     * Konstruktor
     * Liest alle Ausdruecke der Sprache mit ID $languageid in $this->language
     *
     * @param Integer $languageid
     */
    public function __construct($languageid)
    {
        global $core;

        $query = 'SELECT
                    language.name AS name,
                    language.shortname AS shortname,
                    language.dateform AS dateform,
                    language.shortdateform AS shortdateform,
                    expression.name AS expressionname,
                    expression.value AS value
                  FROM `'.TABLEPREFIX.'language` AS language
                  LEFT JOIN `'.TABLEPREFIX.'expression` AS expression ON (language.languageid = expression.languageid)
                  WHERE language.languageid=:languageid';
        $core->db->prepare($query);
        $core->db->bind('languageid',$languageid,Database::PARAM_INT);
        $core->db->Execute();
        $array = $core->db->fetchAll();
        $core->db->free();

        foreach ($array as $value)
        {
            $this->info['name'] = $value['name'];
            $this->info['shortname'] = $value['shortname'];
            $this->info['dateform'] = $value['dateform'];
            $this->info['shortdateform'] = $value['shortdateform'];
            $this->language[$value['expressionname']] = $value['value'];
        }
        unset($array,$query,$value,$languageid);
    }




    /**
     * Gibt einen Ausdruck zurueck
     *
     * @param String $name
     * @return String
     */
    public function get($name)
    {
        return($this->language[$name]);
        unset($name);
    }
    
    
    
    
    
    public function info($name)
    {
        return $this->info[$name];
    }




    /**
     * Destruktor
     */
    public function __destruct()
    {
        unset($this->language);
    }





}
?>